package com.woniu.mapper.healthSystem;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniu.model.healthSystem.entity.Permission;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 权限等级分配表 Mapper 接口
 * </p>
 *
 * @author gb
 * @since 2023-10-19
 */
public interface PermissionMapperGb extends BaseMapper<Permission> {

    @Select("SELECT \n" +
            "DISTINCT p.* \n" +
            "FROM h_permission p\n" +
            "  INNER JOIN h_role_permission rp ON p.id=rp.permission_id\n" +
            "  INNER JOIN h_manager_role mr ON rp.role_id=mr.role_id\n" +
            "WHERE 1=1\n" +
            "  AND mr.manager_id=#{managerId}")
    List<Permission> findPermissionByManagerId(Long managerId);

}
